# from google.appengine.api import app_identity
import urllib2

apiKey = "AIzaSyCtVtAW9-O9ICRsaeGaWMqqAdrwA0h3za4"
scopes = ['https://www.googleapis.com/auth/mapsengine.readonly']

def getToken():

	try:
		token, x = app_identity.get_access_token(scopes)
	except:
		token = urllib2.urlopen("http://nicksdemospace.appspot.com/unswheatmap/default/token.html").read()

	return token

	
def token():

	token, x = app_identity.get_access_token(scopes)
	
	return dict(token=token)


def index():

	token = getToken()

	return dict(apiKey=apiKey, token=token)